package com.ruoyi.fina.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fina.mapper.FinBudgetMapper;
import com.ruoyi.fina.domain.FinBudget;
import com.ruoyi.fina.service.IFinBudgetService;
import com.ruoyi.common.core.text.Convert;

/**
 * 预算Service业务层处理
 * 
 * @author useragent-1
 * @date 2025-05-26
 */
@Service
public class FinBudgetServiceImpl implements IFinBudgetService 
{
    @Autowired
    private FinBudgetMapper finBudgetMapper;

    /**
     * 查询预算
     * 
     * @param budgetId 预算主键
     * @return 预算
     */
    @Override
    public FinBudget selectFinBudgetByBudgetId(Long budgetId)
    {
        return finBudgetMapper.selectFinBudgetByBudgetId(budgetId);
    }

    /**
     * 查询预算列表
     * 
     * @param finBudget 预算
     * @return 预算
     */
    @Override
    public List<FinBudget> selectFinBudgetList(FinBudget finBudget)
    {
        return finBudgetMapper.selectFinBudgetList(finBudget);
    }

    /**
     * 新增预算
     * 
     * @param finBudget 预算
     * @return 结果
     */
    @Override
    public int insertFinBudget(FinBudget finBudget)
    {
        finBudget.setCreateTime(DateUtils.getNowDate());
        return finBudgetMapper.insertFinBudget(finBudget);
    }

    /**
     * 修改预算
     * 
     * @param finBudget 预算
     * @return 结果
     */
    @Override
    public int updateFinBudget(FinBudget finBudget)
    {
        finBudget.setUpdateTime(DateUtils.getNowDate());
        return finBudgetMapper.updateFinBudget(finBudget);
    }

    /**
     * 批量删除预算
     * 
     * @param budgetIds 需要删除的预算主键
     * @return 结果
     */
    @Override
    public int deleteFinBudgetByBudgetIds(String budgetIds)
    {
        return finBudgetMapper.deleteFinBudgetByBudgetIds(Convert.toStrArray(budgetIds));
    }

    /**
     * 删除预算信息
     * 
     * @param budgetId 预算主键
     * @return 结果
     */
    @Override
    public int deleteFinBudgetByBudgetId(Long budgetId)
    {
        return finBudgetMapper.deleteFinBudgetByBudgetId(budgetId);
    }
}
